<?php
/*
 * Created on 2012-7-12
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */
 class user_m extends CI_Model{
 	const TB = 'users';
	function __construct(){
		parent::__construct();
	}
/*
 * @目的 检测用户名，密码是否正确，正确则返回true
 * @param $where 数组
 */
	function check_user($where){
		$data = $this->db->select('*')
						->from(self::TB)
						->where($where)
						->get();
		if($data->num_rows>0){
			return true;
		}
	}
	function get_id_by_username($username){
		if($username ==''){
			return false;
		}
		$query = $this->db->select('userid')
						->from(self::TB)
						->where(array('username'=>$username))
						->get();
		return $query;
	}
	function get_action_list($userid){
		$this->db->select('roleid,actionadd,actioncut');
		$this->db->from(self::TB);
		$this->db->where(array('userid'=>$userid));
		return $query = $this->db->get();
	}
 }
?>
